package edu.whu.assignment8.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.whu.assignment8.dataobject.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.cache.annotation.Cacheable;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from user where username = #{username}")
    @Cacheable(cacheNames = "user", key = "#username", condition = "#username!=null")
    User selectByUsername(String username);

}
